﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RedirectOA.aspx.cs" Inherits="RedirectOA" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>

    <script type="text/javascript" language="javascript">
        function formSubmit() {
            getArgs();
            document.forms[0].submit();
        }
        function getArgs() {
            //加上substring的意义是去掉查询字符串中的？号。
            var query = window.location.search.substring(1);

            //定义一个数组，用于存放取出来的字符串参数。
            var argsArr = new Object();

            //获取URL中的查询字符串参数
            var query = window.location.search;
            query = query.substring(1);

            //这里的pairs是一个字符串数组
            var pairs = query.split("&"); //name=myname&password=1234&sex=male&address=nanjing
            //设置计算时间
            var myDate = new Date();
            var timelogin = parseInt(myDate.getHours()) * 3600 + parseInt(myDate.getMinutes()) * 60 + parseInt(myDate.getSeconds())
            if (pairs.length = 4) {
                var user = document.getElementById("Username");
                var pass = document.getElementById("password");
                var time = document.getElementById("loginTime");
                user.value = pairs[1].substring(pairs[1].indexOf("=") + 1, pairs[1].length);
                pass.value = pairs[2].substring(pairs[2].indexOf("=") + 1, pairs[2].length);
                time.value = timelogin;
                
            }

            return argsArr;
        } 
    </script>

</head>
<body onload="formSubmit()">
    <form id="form1" method="post" action="http://oa.dooshion.com/names.nsf?Login" runat="server">
    <div>
        <input id="loginTime" type="text" name="loginTime" value="" />
        <input id="Username" type="text" name="Username" value="" />
        <input id="password" type="password" name="password" value="" />
        <br />
        正在跳转至OA系统，请稍候<img alt="" src="images/loading.gif" style="width: 16px; height: 16px" /></div>
    </form>
</body>
</html>
